package se.jagvetintedu;

//
//2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
//
//What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

public class Problem5 {
	
	Integer smallestNumber() {
		Integer number = 0;
		boolean found = false;
		while (number < Integer.MAX_VALUE && !found) {
			number += 20;
//			System.out.print("testing: " + number);
			found = true;
			for (int t = 1; t <=20; t++) {
				if (number%t != 0) {
					found = false;
//					System.out.println(" not divisible by " + t + "(" + number + "%" + t + "=" + number%t + ")");
					break;
				}
			}
		}
		return number;
	}
	public static void main(String args[])
	{
		System.out.println("Project Euler, problem 5");
		
		Problem5 solution = new Problem5();
		System.out.println("Smallest positive number evently divisible by 1-20: " + solution.smallestNumber());
	}
}
